package com.geor.gcv.core.process;

import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;

public class ResizeProcessAny extends Process {
	private Process process;
	private int width;
	private int height;
	private Size size;

	public ResizeProcessAny(Process process, int width, int height) {
		this.process = process;
		this.width = width;
		this.height = height;
	}

	public ResizeProcessAny(Process process, Size size) {
		this.process = process;
		this.size = size;
	}

	@Override
	public Mat process() {
		Mat mat = process.process();
		Mat result = new Mat();
		if (size == null)
			Imgproc.resize(mat, result, new Size(width, height));
		if (size != null)
			Imgproc.resize(mat, result, size);
		return result;
	}

	@Override
	public String getProcessName() {
		return process.getProcessName() + "-->缩放图像为:" + width + "*" + height
				+ "像素";
	}

}
